package writtenexamination.sougou;

import org.apache.commons.math3.geometry.euclidean.oned.Interval;

import java.util.Scanner;

/**
 * @author cyt
 * @create 2020-09-24 13:52
 */
public class Ta {
    public static void main(String[] args) {
        Ta ta = new Ta();
        Interval solve = ta.solve(3, 2, "BCD", "CCD");
        System.out.println(solve.getLower());
        System.out.println(solve.getUpper());

    }

    public Interval solve(int n, int k, String str1, String str2) {
        // write code here
        Interval ans = null;
        if (str1.equals(str2)) {
            ans = new Interval(k, k);
        } else {
            char[] arr1 = str1.toCharArray();
            char[] arr2 = str2.toCharArray();
            int count = 0;
            for (int i = 0; i < arr2.length; i++) {
                if (arr1[i] == arr2[i]) {
                    count++;
                }
            }
            int low = 0;
            int high = 0;
            if (count == 0) {
                ans = new Interval(low, n - k);
            } else {
                ans = new Interval(count, n - k);
            }
        }
        return ans;
    }
}
